<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>添加/编辑文章 </title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="STYLESHEET" type="text/css" href="${base}/res/admin/css/tab.css"/>
<script type="text/javascript" src="${base}/res/comm/js/jquery/jquery.js"></script>
<script type="text/javascript" src="${base}/res/admin/js/admin.js"></script>
<script type="text/javascript" src="${base}/res/comm/js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="${base}/res/comm/js/kindeditor/lang/zh_CN.js"></script>
<script>
	var editor;
	KindEditor.ready(function(K) {
	editor = K.create('textarea[name="body"]', {
		items : [
			'source','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'image', 'link']
		});
	});
	
	function save(){
		editor.sync();
		ajaxPost('${base}/admin/article/save.jhtml',{
			'id':$('#id').val(),
			'title':$('#title').val(),
			'cid':$('#cid').val(),
			'order':$('#order').val(),
			'keywords':$('#keywords').val(),
			'description':$('#description').val(),
			'body':$('#body').val(),
			'state':$('input:radio[name="state"]:checked').val()
			},null,'json',savecallback);
	}
	function savecallback(data){
		window.alert(data.message);
		if(data.status=='success'){
			window.location.href='${base}/admin/article/index.jhtml';	
		}
	}
</script>

</head>
<body style="overflow:auto;">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
	    <td height="30">
	    <table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td width="15" height="30"><img src="${base}/res/admin/images/tab_03.gif" width="15" height="30" /></td>
	        <td background="${base}/res/admin/images/tab_05.gif"><img src="${base}/res/admin/images/311.gif" width="16" height="16" /> <span class="STYLE4" style="16">添加/编辑文章</span></td>
	        <td width="14"><img src="${base}/res/admin/images/tab_07.gif" width="14" height="30" /></td>
	      </tr>
	    </table>
	    </td>
	  </tr>
	  <tr>
	    <td>
	    <table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td width="9" background="${base}/res/admin/images/tab_12.gif">&nbsp;</td>
	        <td bgcolor="#e5f1d6">
	        <input type="hidden" id="id" name="id" value="${(article.id)!0}" />
	        <table width="99%" border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#CECECE">
    		<tr>
		   		<td width="15%" height="18" bgcolor="#FFFFFF"><span class="STYLE1">文章标题:</span></td>
		   		<td width="65%" height="18" bgcolor="#FFFFFF"><input id="title" name="title" value="${(article.title)!""}" class="x-html-editor-wrap" style="width:300px;"/></td>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF"><span class="STYLE1">所属分类:</span></td>
		   		<td height="18" bgcolor="#FFFFFF">
		   		<select id="cid" name="cid" style="width:300px;">
		   		<#if articleCategoriesList??>
		   		<#list articleCategoriesList as list>
		   		<option value="${list.id}" <#if ((article.cid)!0)?int=list.id?int>selected</#if>>${list.name}</option>
		   		</#list>
		   		</#if>
		   		</select>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF"><span class="STYLE1">排序:</span></td>
		   		<td height="18" bgcolor="#FFFFFF"><input id="order" name="order" value="${(article.order)!0}" class="x-html-editor-wrap" style="width:300px;"/></td>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF"><span class="STYLE1">页面关键词:</span></td>
		   		<td height="18" bgcolor="#FFFFFF"><input id="keywords" name="keywords" value="${(article.keywords)!""}" style="width:300px;"/></td>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF"><span class="STYLE1">页面描述:</span></td>
		   		<td height="18" bgcolor="#FFFFFF"><input id="description" name="description" value="${(article.description)!""}" style="width:300px;"/></td>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF"><span class="STYLE1">内容:</span></td>
		   		<td height="18" bgcolor="#FFFFFF"><textarea id="body" name="body" style="width:700px;height:350px;visibility:hidden;">${(article.body)!""}</textarea></td>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF"><span class="STYLE1">是否发布:</span></td>
		   		<td height="18" bgcolor="#FFFFFF"><input name="state" type="radio" value="1" <#if ((article.state)!0)?int==1>checked</#if>/>是<input name="state" type="radio" value="0" <#if ((article.state)!0)?int==0>checked</#if>/>否</td>
		  		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		  	</tr>
		  	<tr>
		   		<td height="18" bgcolor="#FFFFFF" colspan=2 align="center">
		   			<input type="button" value="保存"  onclick="save()"/>&nbsp;&nbsp;
		   			<input type="button" value="取消" onclick="window.history.back(-1)">
		   		</td>
		   		<td width="50%"  bgcolor="#FFFFFF">&nbsp;</td>
		   	</tr>
		  	
		 	</table>
        </td>
        <td width="9" background="{base}/res/admin/images/tab_16.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="${base}/res/admin/images/tab_20.gif" width="15" height="29" /></td>
        <td background="${base}/res/admin/images/tab_21.gif">&nbsp;</td>
        <td width="14"><img src="${base}/res/admin/images/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>